import java.util.*;

public class HashMapTest {
    public static void main(String[] args) {
        HashMap<Integer, String> treeMap = new HashMap<>();

        treeMap.put(17, "吴春蕾");
        treeMap.put(33, "赵晓萱");
        treeMap.put(14, "陈奇");
        treeMap.put(13, "张豪龙");

        Set<Integer> keySet = treeMap.keySet();
        for (Integer key : keySet) {
            System.out.println("key = " + key);
        }

        Collection<String> values = treeMap.values();
        for (String value : values) {
            System.out.println("value = " + value);
        }

        Set<Map.Entry<Integer, String>> entries = treeMap.entrySet();
        for (Map.Entry<Integer, String> entry : entries) {
            System.out.println(entry);
        }

        HashMap<Integer, String> map = new HashMap<>();
        map.put(18, "王宁");

        treeMap.putAll(map);
        int size = treeMap.size();
        System.out.println("size = " + size);
        map.clear();
        boolean empty = map.isEmpty();
        System.out.println("empty = " + empty);

        String s = treeMap.get(33);
        System.out.println("s = " + s);

        boolean key = treeMap.containsKey(22);
        System.out.println("key = " + key);
        boolean value = treeMap.containsValue("陈奇");
        System.out.println("value = " + value);

        String remove = treeMap.remove(17);
        System.out.println("remove = " + remove);
    }
}
